<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改批量订单</title>
<script language="javascript">
    $(document).ready(function(){
        $("#saveForm").click(function () {
            var param = $('form').serialize();
            $.post("/batchorder/addBatchOrder",{param: param}, function (data) {
                if (data.code) {
                    alert(data.msg);
                    location.href = '/batchorder/batchOrderList'
                } else {
                    alert(data.msg);
                    return false;
                }
            }, "json");
        });
    });
    //返回首页
    function returnBack()
    {
        window.location.href="/batchorder/batchOrderList";
    }
    //作废
    function del(){
        var fdel=window.confirm("是否确定作废？");
        if (fdel){
            var url = "/batchorder/delBatchOrder"+location.search+"&status=3";
            //alert(url);return ;
            location.href = url;
        }else{
            return false;
        }
    }

</script>
<body class="withvernav">
<div class="bodywrapper"> {{include file='/public/leftmenu.tpl'}}
    <div class="centercontent">
        <div class="pageheader notab">
            <h1 class="pagetitle">修改批量订单</h1>
        </div>
        <!--pageheader-->
        <div id="contentwrapper" class="contentwrapper">
            <div id="basicform" class="subcontent">
                <form class="stdform stdform2"  id="otherForm" method="post" action="/batchorder/addBatchOrder" enctype="multipart/form-data" >
                    <table cellpadding="0" cellspacing="0" border="0" class="stdtable" id="showtable">
                        <tbody>
                        <tr>
                            <td class="head1"></td>
                            <td class="head0">
                                <span id="showimg"></span>
                            </td>
                            <td class="head1"></td>
                            <td class="head0"></td>
                            <td class="head1"></td>
                        </tr>
                        <tr>
                            <td class="head1">工厂</td>
                            <td class="head0">
                                <select class="selectCss2" name="factorys" id="factorys">
                                    <option value="">请选择</option>
                                    {{foreach from=$factorys item=res key=key}}
                                    <option value="{{$res.id}}" {{if $res.id eq $batchorder.factory_id}} selected {{/if}}> {{$res.name}} </option>
                                    {{/foreach}}
                                </select></td>
                            </td>
                        </tr>
                        <tr>
                            <td class="head1">生产日期</td>
                            <td class="head0"><input type="text" name="produce_day" class="width100" value="{{$batchorder.produce_date}}" disabled></td>
                            <td class="head1"></td>
                            <td class="head0"></td>
                            <td class="head1"></td>
                        </tr>
                        <tr>
                            <td class="head1">交货日期</td>
                            <td class="head0"><input type="text" name="finish_day" class="width100" value="{{$goods.finish_day}}" disabled></td>
                            <td class="head1"></td>
                            <td class="head0"></td>
                            <td class="head1"></td>
                        </tr>
                        <tr>
                            <td class="head1">客服希望交货日</td>
                            <td class="head0" ><input type="text" name="customer_day" class="width100" value="{{$batchorder.goods_date}}" onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker"></td>
                            <td class="head1"></td>
                            <td class="head0"></td>
                            <td class="head1"></td>
                        </tr>
                        <tr>
                            <td class="head1">打款日期</td>
                            <td class="head0"><input type="text" name="remit_day" class="width100" value="{{$goods.remit_day}}" disabled></td>
                            <td class="head1"></td>
                            <td class="head0"></td>
                            <td class="head1"></td>
                        </tr>
                        <tr>
                            <td class="head1">生产工厂</td>
                            <td colspan="4" class="head0">
                                <select class="selectCss2" name="producefactorys" id="producefactorys" >
                                    <option value="">请选择</option>
                                    {{foreach from=$producefactorys item=res key=key}}
                                    <option value="{{$res}}" >{{$res}}</option>
                                    {{/foreach}}
                                </select></td>
                            </td>
                        </tr>
                        <tr id="beizhu">
                            <td class="head1">备注信息</td>
                            <td class="head0" colspan="4">
                                <textarea name="memo" cols="10" rows="6">{{$batchorder.memo}}</textarea>
                            </td>
                        </tr>
                        {{if $batchorder.status==1}}
                            <tr>
                            <td class="head1">
                                <button type="button" id ="suresave" class="btn btn-primary">确认保存</button>
                            </td>
                             <!--
                            <td class="head0">
                                <button type="button" id ="produce" class="btn btn-primary">开始生产</button>
                            </td>
                            -->
                                <td class="head0">
                                    <button type="button" id ="deliver_goods" class="btn btn-primary">确认交货</button>
                                </td>
                            <td class="head1">
                                <button type="button" id ="abandon" class="btn btn-primary" onclick="del()">作废</button>
                            </td>
                            <td class="head0">
                                <button type="button" id ="returnback" class="btn btn-primary" onclick="returnBack()">返回</button>
                            </td>
                            <td colspan="2" class="head1">
                            </td>
                        </tr>
                        {{/if}}
                        </tbody>
                    </table>
                    <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
                        <tbody>
                        <tr style="background-color: #b6cad2;">
                            <td class="head0"><a onClick="allSelect('ppid[]')">全选</a></td>
                            <td class="head1">商品编号</td>
                            <td class="head1">关联sku</td>
                            <td class="head0">图片</td>
                            <td class="head1">商品名称</td>
                            <td class="head0">产品型号</td>
                            <td class="head1" style="width:100px;">生产数量</td>
                            <!--
                                <td class="head0">裁剪</td>
                                <td class="head1">车工</td>
                            -->
                            <td class="head0">备注</td>
                            <td class="head0" style="width:100px;">工价</td>
                            <!--
                            <td class="head0">生产工厂</td>
                            -->
                            <td class="head0">商品状态</td>
                            <td class="head1">操作</td>
                        </tr>
                        {{foreach from=$batchorder_list item=res key=key}}
                        <tr>
                            <td class="head0"><input name="ppid[]" type="checkbox" class="none" id="ppid[]" value="{{$res.id}}" /></td>
                            <td class="head1">{{$res.goods_code}}</td>
                            <td class="head1"></td>
                            <td class="head0"><img src="{{$res.thumb_url}}"></td>
                            <td class="head1">{{$res.goods_name}}</td>
                            <td class="head0">{{$res.product_type}}</td>
                            <td class="head1">
                                {{$res.product_num}}<br/>
                                <input type="text" name="upd_num" id="upd_num" value="">
                            </td>
                            <!--
                                <td class="head0">{{$res.caijian_id}}</td>
                                <td class="head1">{{$res.workers_id}}</td>
                                -->
                            <td class="head0">
                                {{$res.memo}}
                                <input type="text" name="upd_memo" id="upd_memo" value="">
                            </td>
                            <td class="head0">
                                {{$res.price}}
                                <input type="text" name="upd_price" id="upd_price" value="">
                            </td>
                            <!--
                                <td class="head0">
                                    <select class="selectCss2" name="prodfactorys" id="prodfactorys">
                                        <option value="">请选择</option>
                                        {{foreach from=$producefactorys item=rs key=key}}
                                            <option value="{{$rs}}"> {{$rs}} </option>
                                        {{/foreach}}
                                    </select>
                                </td>
                                -->
                            <td class="head0">
                                {{if $res.status eq 1}}
                                生产中
                                {{elseif $res.status eq 2}}
                                已完成
                                {{elseif $res.status eq 3}}
                                已作废
                                {{elseif $res.status eq 5}}
                                交货中
                                {{elseif $res.status eq 6}}
                                工厂验货已完成
                                {{elseif $res.status eq 7}}
                                公司验收已完成
                                {{elseif $res.status eq 8}}
                                打款中
                                {{else}}
                                新订单
                                {{/if}}
                            </td>
                            <!--
                            <td class="head1"><a href="">删除</a></td>-->
                        </tr>
                        {{/foreach}}
                        {{if $batchorder.status==1}}
                            <tr>
                                <td><button type="submit" class="btn btn-primary" >确认保存</button>
                                </td>
                            </tr>
                        {{/if}}
                        </tbody>
                    </table>
                    <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
                        <thead>
                        <tr>
                            <td>修改时间</td>
                            <td>订单编号</td>
                            <td>操作详情</td>
                            <td>操作人员</td>
                        </tr>
                        </thead>
                        <tbody>
                        {{foreach from=$logs item=rs key=key}}
                            <tr>
                                <td>{{$rs.createtime}}</td>
                                <td>{{$rs.order_id}}</td>
                                <td>{{$rs.details}}</td>
                                <td>{{$rs.username}}</td>
                            </tr>
                        {{/foreach}}
                        </tbody>
                    </table>
                </form>
                <br />
            </div>
            <!--subcontent-->

            <!--subcontent-->

        </div>
        <!--contentwrapper-->

    </div>
    <!-- centercontent -->

</div>
<!--bodywrapper-->

</body>
</html>